[Lab2 – Modify the Configuration of Buildroot and Rebuild]
----------------------------------------------------------------
----------------------------------------------------------------

/* Use the menu to configure Buildroot. */
/* Execute Commands on Host PC */
cd ~/Linux4MCHP/buildroot-mchp
make menuconfig

/* Modify the Login Welcome Message for SAM9X60 Hobby Kit */
( [Buildroot] --> [System configuration] --> [System banner] )
Welcome to the Microchip SAM9X60 Hobby Kit

/* Modify the System hostname for SAM9X60 Hobby Kit */
( [Buildroot] --> [System configuration] --> [System hostname] )
sam9x60_hobby

----------------------------------------------------------------

/* Execute Commands on Host PC */
code ~/Linux4MCHP/buildroot-mchp/output/build/linux-custom/arch/arm/boot/dts/microchip/at91-sam9x60_curiosity.dts

----------------------------------------------------------------

// Remove the part of can0, ​​can1, ebi, nand

----------------------------------------------------------------

/* Modify the Device-Tree-Source - Heartbeat Trigger*/
    leds {
        ...

        led-green {
            label = "green";
            gpios = <&pioD 19 GPIO_ACTIVE_HIGH>;
            linux,default-trigger = "heartbeat";
        };

        led-blue {
            label = "blue";
            gpios = <&pioD 21 GPIO_ACTIVE_HIGH>;
        };
    };

----------------------------------------------------------------

/* Modify the Device-Tree-Source - GPIO Keys */
    gpio-keys {
        compatible = "gpio-keys";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_key_gpio_default>;

        button-user {
            label = "PB_USER";
            gpios = <&pioD 3 GPIO_ACTIVE_LOW>;
            linux,code = <KEY_PROG1>;
            wakeup-source;
        };
    };

...

&pinctrl {
    ...

    gpio-keys {
        pinctrl_key_gpio_default: pinctrl-key-gpio {
            atmel,pins = <AT91_PIOD 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
        };
    };

    ...

};

----------------------------------------------------------------

/* Modify the Device-Tree-Source - Create SPI node */
&flx5 {
    atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
    status = "okay";

    spi5: spi@400 {
        dmas = <0>, <0>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_flx5_default>;
        status = "okay";

        spidev@0 {
            compatible = "rohm,dh2228fv";
            reg = <0>;
            spi-max-frequency = <1000000>;
        };
    };
};

...

&pinctrl {
    ...

    flexcom {
        ...

        pinctrl_flx5_default: flx5_spi {
            atmel,pins =
                <AT91_PIOA 22 AT91_PERIPH_B AT91_PINCTRL_PULL_UP
                 AT91_PIOA 21 AT91_PERIPH_B AT91_PINCTRL_PULL_UP
                 AT91_PIOA 23 AT91_PERIPH_B AT91_PINCTRL_PULL_UP
                 AT91_PIOA 8 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>;
        };

        ...
    };

    ...

};

----------------------------------------------------------------

/* Modify the Device-Tree-Source - SD Card Detect */
&sdmmc0 {
    bus-width = <4>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_sdmmc0_default &pinctrl_sdmmc0_cd>;
    cd-gpios = <&pioD 2 GPIO_ACTIVE_LOW>;
    disable-wp;
    status = "okay";
};

...

&pinctrl {
    ...

    sdmmc0 {
        ...

        pinctrl_sdmmc0_cd: sdmmc0-cd {
            atmel,pins =
                <AT91_PIOD 2 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
        };
    };

    ...

};

----------------------------------------------------------------
----------------------------------------------------------------

/* Rebuild the Buildroot for Hobby Kit */
/* Execute Commands on Host PC */
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
cd ~/Linux4MCHP/buildroot-mchp
make linux-rebuild
make dt-overlay-mchp-rebuild
make
ls -l ./output/images

----------------------------------------------------------------

/* View the modified section of heartbeat triger in the Device-Tree */
/* Execute Commands on EVB */
ls /proc/device-tree/leds/led-blue/
ls /proc/device-tree/leds/led-green/
cat /proc/device-tree/leds/led-green/linux,default-trigger

----------------------------------------------------------------

/* Reboot Linux system to show the Welcome Message */
/* Execute Commands on EVB */
reboot

----------------------------------------------------------------
